package WebModule::TrainStation;

use strict;

use base qw(WebModule);

__PACKAGE__->meta->setup(
    table   => 'train_station',

    columns => [
        id             => { type => 'serial', not_null => 1 },
        train_id       => { type => 'integer', not_null => 1 },
        station_id     => { type => 'integer', not_null => 1 },
        arrive_time    => { type => 'time', default => '00:00:00', not_null => 1, precision => 6, scale => 6 },
        start_out_time => { type => 'time', default => '00:00:00', not_null => 1, precision => 6, scale => 6 },
        cost_time      => { type => 'varchar', length => 45, not_null => 1 },
        course         => { type => 'varchar', length => 45, not_null => 1 },
    ],

    primary_key_columns => [ 'id' ],

    unique_key => [ 'train_id', 'station_id' ],

    foreign_keys=>[
        station=>{
            class=>'WebModule::Station',
            key_columns=>{ station_id=>'id' },
        },

        train=>{
            class=>'WebModule::Train',
            key_columns=>{ train_id=>'id'},
        },

    ],

);

1;

